%include "io.inc"

%MACRO CALABS 1
    mov eax, dword [%1]
    mov ebx, 0
    cmp eax, ebx
    jl %%_abs_hit   ;; 给 label 添加特殊前缀 %%_ 以区分宏外部的 label
    jmp %%_abs_end
%%_abs_hit:
    ;; neg 指令作用是计算负值
    neg eax
%%_abs_end:
    ;; push result into stack
    push eax
%ENDMACRO

section .data
X dd -10

section .text
global main
main:
    CALABS X
    pop eax
    PRINT_DEC 4, eax
    xor eax, eax
    ret